package com.ala.dao;

import com.ala.model.Device;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;
public interface DeviceMapper {

    /**
     * 根据设备sn 修改在线状态
     * @param sn
     * @param online
     * @return
     */
    @Update("UPDATE vender_device SET LINE_STATUS=#{lineStatus} WHERE DEVICE_SN =#{sn}")
    int upodateOnlineBySn(@Param("sn")String sn, @Param("lineStatus")int online);


    /**
     * 更改所有的在线状态
     * @param online
     * @return
     */
    @Update("UPDATE vender_device SET LINE_STATUS=#{online}")
    int updateOnline(@Param("online")int online);

    /**
     * 查找所有
     * @return
     */
    @Results({
            @Result(property = "id", column = "ID"),
            @Result(property = "sn", column = "DEVICE_SN"),
            @Result(property = "lineStatus", column = "LINE_STATUS"),
    })
    @Select("SELECT * FROM vender_device")
    List<Device> findAll();




}
